package com.wxm.common.file.core.enm;

import com.wxm.common.file.core.property.*;

import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * <p>
 *      文件供应商枚举
 * </p>
 *
 * @author: wxm
 * @Date: 2022/1/13
 */
public enum FileSupplierEnum {
    LOCAL(1,"本地", LocalOssProperty.class),
    QI_NIU(2,"七牛", QiniuKodoProperty.class),
    U_FILE(3,"UFile", UFileUs3Property.class),
    ALI_YUN(4,"阿里云", AliyunOssProperty.class),
    TENCENT_CLOUD(5,"腾讯云", TencentCloudCosProperty.class)
    ;

    private Integer type;
    private String name;
    private Class<? extends UploadBaseProperty> clazz;

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Class<? extends UploadBaseProperty> getClazz() {
        return clazz;
    }

    public void setClazz(Class<? extends UploadBaseProperty> clazz) {
        this.clazz = clazz;
    }

    FileSupplierEnum(Integer type, String name, Class<? extends UploadBaseProperty> clazz){
        this.type = type;
        this.name = name;
        this.clazz = clazz;
    }

    private static final List<Integer> typeList = Arrays.stream(values()).map(FileSupplierEnum::getType).collect(Collectors.toList());
    public static List<Integer> getTypeList(){
        return typeList;
    }

    private static final Map<Integer,FileSupplierEnum> typeMap =  Arrays.stream(values()).collect(Collectors.toMap(FileSupplierEnum::getType,item -> item));
    public static Map<Integer,FileSupplierEnum> getTypeMap(){
        return typeMap;
    }
}
